Adapt binaries to new cargo_compile API
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>
Fri, 24 Mar 2017 08:28:35 +0000 (09:28 +0100)
committerBen Wiederhake <BenWiederhake.GitHub@gmx.de>
Mon, 10 Apr 2017 18:20:32 +0000 (20:20 +0200)
Closes #3112.

src/bin/bench.rs
src/bin/build.rs
src/bin/check.rs
src/bin/doc.rs
src/bin/install.rs
src/bin/run.rs
src/bin/rustc.rs
src/bin/rustdoc.rs
src/bin/test.rs

index ffca42abed02938fd5f97f68a0ff75edf1a34699..ced1cfc393107fa48d67db4a2c89af2d733aa7ab 100644 (file)
@@ -19,9 +19,13 @@ pub struct Options {
     flag_message_format: MessageFormat,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_frozen: bool,
     flag_locked: bool,
     arg_args: Vec<String>,
@@ -37,9 +41,13 @@ Options:
     -h, --help                   Print this message
     --lib                        Benchmark only this package's library
     --bin NAME                   Benchmark only the specified binary
+    --bins                       Benchmark all binaries
     --example NAME               Benchmark only the specified example
+    --examples                   Benchmark all examples
     --test NAME                  Benchmark only the specified test target
+    --tests                      Benchmark all tests
     --bench NAME                 Benchmark only the specified bench target
+    --benches                    Benchmark all benches
     --no-run                     Compile, but don't run benchmarks
     -p SPEC, --package SPEC ...  Package to run benchmarks for
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
@@ -92,10 +100,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
             release: true,
             mode: ops::CompileMode::Bench,
             filter: ops::CompileFilter::new(options.flag_lib,
-                                            &options.flag_bin,
-                                            &options.flag_test,
-                                            &options.flag_example,
-                                            &options.flag_bench),
+                                            &options.flag_bin, options.flag_bins,
+                                            &options.flag_test, options.flag_tests,
+                                            &options.flag_example, options.flag_examples,
+                                            &options.flag_bench, options.flag_benches,),
             message_format: options.flag_message_format,
             target_rustdoc_args: None,
             target_rustc_args: None,
index 13639c1aa28acb68949349e7256afa059fe50a27..731d563c97738d5a92cf555ac444388f9f6e5ba5 100644 (file)
@@ -21,9 +21,13 @@ pub struct Options {
     flag_release: bool,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_locked: bool,
     flag_frozen: bool,
     flag_all: bool,
@@ -42,9 +46,13 @@ Options:
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
     --lib                        Build only this package's library
     --bin NAME                   Build only the specified binary
+    --bins                       Build all binaries
     --example NAME               Build only the specified example
+    --examples                   Build all examples
     --test NAME                  Build only the specified test target
-    --bench NAME                 Build only the specified benchmark target
+    --tests                      Build all tests
+    --bench NAME                 Build only the specified bench target
+    --benches                    Build all benches
     --release                    Build artifacts in release mode, with optimizations
     --features FEATURES          Space-separated list of features to also build
     --all-features               Build all available features
@@ -99,10 +107,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
         mode: ops::CompileMode::Build,
         release: options.flag_release,
         filter: ops::CompileFilter::new(options.flag_lib,
-                                        &options.flag_bin,
-                                        &options.flag_test,
-                                        &options.flag_example,
-                                        &options.flag_bench),
+                                        &options.flag_bin, options.flag_bins,
+                                        &options.flag_test, options.flag_tests,
+                                        &options.flag_example, options.flag_examples,
+                                        &options.flag_bench, options.flag_benches,),
         message_format: options.flag_message_format,
         target_rustdoc_args: None,
         target_rustc_args: None,
index e13c68b2556aca8f9b534ab222ee21bdda0209ae..20e7b3bfc733cb71b65195489e36a0e9814f4975 100644 (file)
@@ -18,9 +18,13 @@ Options:
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
     --lib                        Check only this package's library
     --bin NAME                   Check only the specified binary
+    --bins                       Check all binaries
     --example NAME               Check only the specified example
+    --examples                   Check all examples
     --test NAME                  Check only the specified test target
-    --bench NAME                 Check only the specified benchmark target
+    --tests                      Check all tests
+    --bench NAME                 Check only the specified bench target
+    --benches                    Check all benches
     --release                    Check artifacts in release mode, with optimizations
     --features FEATURES          Space-separated list of features to also check
     --all-features               Check all available features
@@ -60,9 +64,13 @@ pub struct Options {
     flag_release: bool,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_locked: bool,
     flag_frozen: bool,
     flag_all: bool,
@@ -98,10 +106,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
         mode: ops::CompileMode::Check,
         release: options.flag_release,
         filter: ops::CompileFilter::new(options.flag_lib,
-                                        &options.flag_bin,
-                                        &options.flag_test,
-                                        &options.flag_example,
-                                        &options.flag_bench),
+                                        &options.flag_bin, options.flag_bins,
+                                        &options.flag_test, options.flag_tests,
+                                        &options.flag_example, options.flag_examples,
+                                        &options.flag_bench, options.flag_benches,),
         message_format: options.flag_message_format,
         target_rustdoc_args: None,
         target_rustc_args: None,
index edbb9b2eccdfa83266dd206a1ee7edc577bd7df0..11e44670faf4200137297a71ee725e7871b04fbe 100644 (file)
@@ -21,6 +21,7 @@ pub struct Options {
     flag_package: Vec<String>,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_frozen: bool,
     flag_locked: bool,
     flag_all: bool,
@@ -41,6 +42,7 @@ Options:
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
     --lib                        Document only this package's library
     --bin NAME                   Document only the specified binary
+    --bins                       Document all binaries
     --release                    Build artifacts in release mode, with optimizations
     --features FEATURES          Space-separated list of features to also build
     --all-features               Build all available features
@@ -93,10 +95,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
             no_default_features: options.flag_no_default_features,
             spec: spec,
             filter: ops::CompileFilter::new(options.flag_lib,
-                                            &options.flag_bin,
-                                            &empty,
-                                            &empty,
-                                            &empty),
+                                            &options.flag_bin, options.flag_bins,
+                                            &empty, false,
+                                            &empty, false,
+                                            &empty, false),
             message_format: options.flag_message_format,
             release: options.flag_release,
             mode: ops::CompileMode::Doc {
index 41781a5a51d62a154308708295547b05ba1fe783..197dcdd1be0a292cd240e8da042708258e5b6379 100644 (file)
@@ -10,7 +10,9 @@ pub struct Options {
     flag_no_default_features: bool,
     flag_debug: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_verbose: u32,
     flag_quiet: Option<bool>,
     flag_color: Option<String>,
@@ -54,8 +56,10 @@ Build and install options:
     --all-features            Build all available features
     --no-default-features     Do not build the `default` feature
     --debug                   Build in debug mode instead of release mode
-    --bin NAME                Only install the binary NAME
-    --example EXAMPLE         Install the example EXAMPLE instead of binaries
+    --bin NAME                Install only the specified binary
+    --bins                    Install all binaries
+    --example NAME            Install only the specified example
+    --examples                Install all examples
     --root DIR                Directory to install packages into
     -v, --verbose ...         Use verbose output (-vv very verbose/build.rs output)
     -q, --quiet               Less output printed to stdout
@@ -111,8 +115,11 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
         spec: ops::Packages::Packages(&[]),
         mode: ops::CompileMode::Build,
         release: !options.flag_debug,
-        filter: ops::CompileFilter::new(false, &options.flag_bin, &[],
-                                        &options.flag_example, &[]),
+        filter: ops::CompileFilter::new(false,
+                                        &options.flag_bin, options.flag_bins,
+                                        &[], false,
+                                        &options.flag_example, options.flag_examples,
+                                        &[], false),
         message_format: ops::MessageFormat::Human,
         target_rustc_args: None,
         target_rustdoc_args: None,
index a576cc6660befe44b0ef21fb705714268442cfe8..6d66d26ee4e7c0ef9578ad79afbc34cd0a0ff860 100644 (file)
@@ -94,10 +94,11 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
         filter: if examples.is_empty() && bins.is_empty() {
             ops::CompileFilter::Everything { required_features_filterable: false, }
         } else {
-            ops::CompileFilter::Only {
-                lib: false, tests: &[], benches: &[],
-                bins: &bins, examples: &examples,
-            }
+            ops::CompileFilter::new(false,
+                                    &bins, false,
+                                    &[], false,
+                                    &examples, false,
+                                    &[], false)
         },
         message_format: options.flag_message_format,
         target_rustdoc_args: None,
index bff80feceec627466b0332d5bd0c1077f519da1e..8805c8f8a4ec14f6281d94710ed29cee78604148 100644 (file)
@@ -22,9 +22,13 @@ pub struct Options {
     flag_release: bool,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_profile: Option<String>,
     flag_frozen: bool,
     flag_locked: bool,
@@ -42,9 +46,13 @@ Options:
     -j N, --jobs N           Number of parallel jobs, defaults to # of CPUs
     --lib                    Build only this package's library
     --bin NAME               Build only the specified binary
+    --bins                   Build all binaries
     --example NAME           Build only the specified example
+    --examples               Build all examples
     --test NAME              Build only the specified test target
-    --bench NAME             Build only the specified benchmark target
+    --tests                  Build all tests
+    --bench NAME             Build only the specified bench target
+    --benches                Build all benches
     --release                Build artifacts in release mode, with optimizations
     --profile PROFILE        Profile to build the selected target for
     --features FEATURES      Features to compile for the package
@@ -109,10 +117,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
         mode: mode,
         release: options.flag_release,
         filter: ops::CompileFilter::new(options.flag_lib,
-                                        &options.flag_bin,
-                                        &options.flag_test,
-                                        &options.flag_example,
-                                        &options.flag_bench),
+                                        &options.flag_bin, options.flag_bins,
+                                        &options.flag_test, options.flag_tests,
+                                        &options.flag_example, options.flag_examples,
+                                        &options.flag_bench, options.flag_benches,),
         message_format: options.flag_message_format,
         target_rustdoc_args: None,
         target_rustc_args: options.arg_opts.as_ref().map(|a| &a[..]),
index d82bc3e7e9cd9e3c8e2001dc9a21f30014424e16..b6a8e640e2b03cfe0d8be284806831ba8c1edcbe 100644 (file)
@@ -21,9 +21,13 @@ pub struct Options {
     flag_package: Option<String>,
     flag_lib: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_frozen: bool,
     flag_locked: bool,
 }
@@ -41,9 +45,13 @@ Options:
     -j N, --jobs N           Number of parallel jobs, defaults to # of CPUs
     --lib                    Build only this package's library
     --bin NAME               Build only the specified binary
+    --bins                   Build all binaries
     --example NAME           Build only the specified example
+    --examples               Build all examples
     --test NAME              Build only the specified test target
-    --bench NAME             Build only the specified benchmark target
+    --tests                  Build all tests
+    --bench NAME             Build only the specified bench target
+    --benches                Build all benches
     --release                Build artifacts in release mode, with optimizations
     --features FEATURES      Space-separated list of features to also build
     --all-features           Build all available features
@@ -94,10 +102,10 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
             spec: Packages::Packages(&spec),
             release: options.flag_release,
             filter: ops::CompileFilter::new(options.flag_lib,
-                                            &options.flag_bin,
-                                            &options.flag_test,
-                                            &options.flag_example,
-                                            &options.flag_bench),
+                                            &options.flag_bin, options.flag_bins,
+                                            &options.flag_test, options.flag_tests,
+                                            &options.flag_example, options.flag_examples,
+                                            &options.flag_bench, options.flag_benches,),
             message_format: options.flag_message_format,
             mode: ops::CompileMode::Doc { deps: false },
             target_rustdoc_args: Some(&options.arg_opts),
index 65f9b4482919f93800002ed9600bad0aa1991e79..fda62547d7321cb7d66032183bb0468ef6feb201 100644 (file)
@@ -17,9 +17,13 @@ pub struct Options {
     flag_lib: bool,
     flag_doc: bool,
     flag_bin: Vec<String>,
+    flag_bins: bool,
     flag_example: Vec<String>,
+    flag_examples: bool,
     flag_test: Vec<String>,
+    flag_tests: bool,
     flag_bench: Vec<String>,
+    flag_benches: bool,
     flag_verbose: u32,
     flag_quiet: Option<bool>,
     flag_color: Option<String>,
@@ -41,10 +45,14 @@ Options:
     -h, --help                   Print this message
     --lib                        Test only this package's library
     --doc                        Test only this library's documentation
-    --bin NAME ...               Test only the specified binaries
+    --bin NAME ...               Test only the specified binary
+    --bins                       Test all binaries
     --example NAME ...           Check that the specified examples compile
-    --test NAME ...              Test only the specified integration test targets
-    --bench NAME ...             Test only the specified benchmark targets
+    --examples                   Check that all examples compile
+    --test NAME ...              Test only the specified test target
+    --tests                      Test all tests
+    --bench NAME ...             Test only the specified bench target
+    --benches                    Test all benches
     --no-run                     Compile, but don't run tests
     -p SPEC, --package SPEC ...  Package to run tests for
     --all                        Test all packages in the workspace
@@ -106,14 +114,15 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
     let (mode, filter);
     if options.flag_doc {
         mode = ops::CompileMode::Doctest;
-        filter = ops::CompileFilter::new(true, &empty, &empty, &empty, &empty);
+        filter = ops::CompileFilter::new(true, &empty, false, &empty, false,
+                                               &empty, false, &empty, false);
     } else {
         mode = ops::CompileMode::Test;
         filter = ops::CompileFilter::new(options.flag_lib,
-                                         &options.flag_bin,
-                                         &options.flag_test,
-                                         &options.flag_example,
-                                         &options.flag_bench);
+                                         &options.flag_bin, options.flag_bins,
+                                         &options.flag_test, options.flag_tests,
+                                         &options.flag_example, options.flag_examples,
+                                         &options.flag_bench, options.flag_benches);
     }
 
     let spec = if options.flag_all {